package yifeng.net.socket;

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.UnknownHostException;

public class Client {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			Socket s = new Socket("localhost",10000);
			PrintWriter pw = new PrintWriter(new OutputStreamWriter(s.getOutputStream()));
			
			System.out.println(s.getLocalPort());
			System.out.println(s.getPort());
			System.out.println(s.getLocalSocketAddress());
			System.out.println(s.getRemoteSocketAddress());
			pw.println("hello!!!!!!!!!!!!!");
			pw.flush();
			s.close();
			
		} catch (UnknownHostException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
